using System;

namespace Core.Domain.Enums
{
  ///<summary></summary>
  public class BallotSubmissionMethod : EnumGeneric<BallotSubmissionMethod>
  {
    private readonly string _displayName;
    private readonly bool _isReceived;

    public BallotSubmissionMethod()
    {
      
    }

    ///<summary>Was mailed in</summary>
    public static readonly BallotSubmissionMethod MailedIn = new BallotSubmissionMethod("Mail", "Mailed In", true);
    
    ///<summary></summary>
    public static readonly BallotSubmissionMethod DroppedOffBySelf = new BallotSubmissionMethod("DropS", "Dropped Off by Self", true);
    
    ///<summary></summary>
    public static readonly BallotSubmissionMethod DroppedOffByOther = new BallotSubmissionMethod("DropO", "Dropped Off by Other", true);
    
    ///<summary></summary>
    public static readonly BallotSubmissionMethod VotedInPerson = new BallotSubmissionMethod("Person", "Voted in Person", true);

    ///<summary>Empty inner value</summary>
    public static readonly BallotSubmissionMethod NotSubmitted = new BallotSubmissionMethod("", "Not Submitted", false);
    
    ///<summary></summary>
    public static readonly BallotSubmissionMethod InAttendanceVoteNotYetReceived = new BallotSubmissionMethod("Attending", "Present, ballot not received", false);

    private BallotSubmissionMethod(string innerValue, string displayName, bool isReceived) : base(innerValue)
    {
      _displayName = displayName;
      _isReceived = isReceived;
    }

    static BallotSubmissionMethod()
    {
      Items.Add(NotSubmitted);
      Items.Add(InAttendanceVoteNotYetReceived);
      Items.Add(DroppedOffBySelf);
      Items.Add(DroppedOffByOther);
      Items.Add(MailedIn);
      Items.Add(VotedInPerson);
    }

    public string DisplayName
    {
      get { return _displayName; }
    }

    public bool IsReceived
    {
      get { return _isReceived; }
    }

    public override BallotSubmissionMethod Parse(string value)
    {
      switch(value.ToLower())
      {
        case "mail":
          return MailedIn;
        case "drops":
          return DroppedOffBySelf;
        case "dropo":
          return DroppedOffByOther;
        case "person":
          return VotedInPerson;
        case "attending":
          return InAttendanceVoteNotYetReceived;
      }
      return NotSubmitted;
    }
  }

  /////<summary>How was this ballot submitted?</summary>
  //public enum BallotSubmissionMethodX
  //{
  //  ///<summary>Mailed in before election</summary>
  //  MailedIn,
  //  ///<summary>Dropped off at location by the voter</summary>
  //  DroppedOffBySelf,
  //  ///<summary>Dropped off at location by someone else for the voter</summary>
  //  DroppedOffByOther,
  //  ///<summary>Ballot deposited at location by the voter</summary>
  //  VotedInPerson,
  //  ///<summary>Not submitted</summary>
  //  NotSubmitted,
  //  ///<summary>Person is in attendance, planning to deposit ballot. Deposit not yet received!</summary>
  //  InAttendanceVoteNotYetReceived
  //}
}